package cn.wh.builder;

import cn.wh.mapping.ResultMap;
import cn.wh.mapping.ResultMapping;

import java.util.List;

/**
 * @Author wh
 * @Description 结果映射解析器
 * @Date 2023/7/7 15:41
 * @Version 1.0
 **/
public class ResultMapResolver {

    private final MapperBuilderAssistant assistant;


    private String id;

    private Class<?> type;

    private List<ResultMapping> resultMappings;


    public ResultMapResolver(MapperBuilderAssistant assistant, String id, Class<?> type, List<ResultMapping> resultMappings) {
        this.assistant = assistant;
        this.id = id;
        this.type = type;
        this.resultMappings = resultMappings;
    }

    public ResultMap resolve() {
        return assistant.addResultMap(this.id, this.type, this.resultMappings);
    }
}
